/**
 * 
 */
package com.gragra.sampling.nonproj.generators;
import java.io.BufferedReader;
import java.io.IOException;
import java.util.ArrayList;
import com.gragra.benchmark.CreateCorpusAndGoldAssigner;
import com.gragra.benchmark.FractionAblePopulationStructure;
import com.gragra.sampling.PopulationProbabilityAssigner;
import com.gragra.sampling.nonproj.FixedParsesAssigner;
/**
 * @author Christoph Teichmann
 * 22.09.2013
 */
public class CreateDepdCorpusAndAssigner implements
		CreateCorpusAndGoldAssigner
{
	/**
	 * @param cnc
	 */
	public CreateDepdCorpusAndAssigner(CreateDependencyCorpus cnc)
	{this.cnc = cnc;}
	/**
	 * 
	 */
	private final CreateDependencyCorpus cnc;
	/**
	 * 
	 */
	private FixedParsesAssigner	ass;
	/* (non-Javadoc)
	 * @see com.gragra.benchmark.CreateCorpusAndGoldAssigner#makeCorpusAndAssigner(java.io.BufferedReader, java.io.BufferedReader, int, double, double, int)
	 */
	@Override
	public void makeCorpusAndAssigner(BufferedReader br, BufferedReader brGold,
			int threads, double smoothing, double weight, int depth)
			throws IOException
	{
		fas = cnc.createCorpus(br, threads, smoothing).getEntry(0);
		ArrayList<String> al = new ArrayList<String>();
		String line;
		while((line = brGold.readLine()) != null)
		{al.add(line);}
		ass = new FixedParsesAssigner(threads, weight, depth, al);
	}
	/* (non-Javadoc)
	 * @see com.gragra.benchmark.CreateCorpusAndGoldAssigner#getAssigner()
	 */
	@Override
	public PopulationProbabilityAssigner getAssigner()
	{return this.ass;}
	/**
	 * 
	 */
	private FractionAblePopulationStructure fas;
	/* (non-Javadoc)
	 * @see com.gragra.benchmark.CreateCorpusAndGoldAssigner#getStructure(int)
	 */
	@Override
	public FractionAblePopulationStructure getStructure(int position)
	{return this.fas;}
}